import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
// 导入样式重置
import './assets/common.css'
import qs from 'qs'
Vue.prototype.$qs = qs;
//挂载eachrt插件到原型
import echarts from 'echarts'
console.log(echarts)
Vue.prototype.$echarts = echarts


Vue.config.productionTip = false;
// 
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios)

// 使用element-ui的组件
import { Select, Option, Table, Pagination, TableColumn, Dialog, Button, BreadcrumbItem, Breadcrumb, Icon, Message, MessageBox, Loading, Notification, Form, Input, FormItem } from 'element-ui'
Vue.use(Form)
Vue.use(Select)
Vue.use(Option)
Vue.use(Button)
Vue.use(Input)
Vue.use(FormItem)
Vue.use(Icon)
Vue.use(Pagination)
Vue.use(Dialog)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Table)
Vue.use(TableColumn)
Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;

// 路由的全局钩子函数
router.beforeEach((to, from, next) => {
  console.log(from)
  if (to.name == "login") {
    store.dispatch("navFlagAction", false)
  } else {
    store.dispatch("navFlagAction", true)
  }
  next();
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
